package com.lfs.adapter.controller;

import com.lfs.adapter.service.GameOrderService;
import com.lfs.interfaces.dto.ResultReturn;
import com.lfs.interfaces.model.GameBaseResponse;
import com.lfs.interfaces.model.NotifyModel;
import com.lfs.interfaces.model.dto.OrderDto;
import com.lfs.interfaces.model.vo.ChargeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 游戏订单处理下单,回调,查询处理
 */
@RestController
@RequestMapping("/gameOrder")
public class GameOrderController {

	@Autowired
	private GameOrderService gameOrderService;


	/**
	 * 充值提交订单接口
	 * @param orderInfo
	 * @return
	 */
	@RequestMapping(value = "/submitOrder", method = RequestMethod.POST)
	@ResponseBody
	public ResultReturn<ChargeVo> submitOrder(@RequestBody(required = true) OrderDto orderInfo) {

		return gameOrderService.makeOrder(orderInfo);

	}

	/**
	 * 回调处理接口
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "notify", method = RequestMethod.POST)
	@ResponseBody
	public String notify(@RequestBody(required=true) NotifyModel model){
		return gameOrderService.notify(model);
	}


	/**
	 * 查询余额接口
	 * @param channelCode
	 * @return
	 */
	@RequestMapping(value = "queryBalance")
	@ResponseBody
	public String queryBalance(String channelCode){
		return gameOrderService.queryBalance(channelCode);
	}

	@RequestMapping(value = "queryInfo")
	@ResponseBody
	public GameBaseResponse queryInfo(String orderNo) {
		return gameOrderService.queryInfo(orderNo);
	}
	
}
